<?php

declare(strict_types=1);

namespace App\Request;

use Hyperf\Validation\Request\FormRequest;

class SMSRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'scene' => 'required|in:register,resetPassword,login',
            'phone' => 'required|regex:/^1[3456789]\d{9}$/i',
        ];
    }

    public function attributes(): array
    {
        return [
            'scene' => '场景',
            'phone' => '手机号码',
        ];
    }
}
